package com.darkplanet.management.controller;

import com.darkplanet.management.domain.Project;
import com.darkplanet.management.service.ProjectService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/ProjectBaseDeleteServlet")
public class ProjectBaseDeleteServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        ProjectService projectService = new ProjectService();
        String project_id_str = request.getParameter("project_id");
        Integer project_id = Integer.valueOf(project_id_str);
        projectService.deleteProject(project_id);
        request.getRequestDispatcher("/ProjectBaseServlet").forward(request,response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }
}
